<template>
	<view class="news">
		<news-item :news="news" @goDetail="goDetail"></news-item>
	</view>
</template>

<script>
	import NewsItem from '../../components/newsItem/NewsItem.vue'
	export default {
		data() {
			return {
				news:[],
			}
		},
		components: {
			NewsItem
		},
		onLoad() {
			this.getNews()
		},
		methods: {
			async getNews(){
				const res = await this.$myRequest({
					url:"getNews.json"
				})
				// console.log(res)
				this.news = res.data.message
			},
			goDetail(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/detail/detail?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	
</style>
